﻿/*** 公共 Callback START ***/

//*************************************
//* 客服系统 -> 客服反馈
//* 获取“游戏应用信息字典”callback
//*************************************
var getAppInfoDictionaryCallback = {
	Convert : function(back){
		if (back.data != "") {
			look._APP_INFO_DIC_ARRAY.length = 0;
			$.each(back.data.apps, function(i){
				look._APP_INFO_DIC_ARRAY.push(new Array(back.data.apps[i].appid, back.data.apps[i].name, back.data.apps[i].serverIds));
			});
			getAppInfoDictionaryCallback.Assay();
		}
		else {
			look.showInfo.error(back.code + look._I18N_DATA.$412/**:游戏应用信息字典数据为空…**/);
		}
	},
	Assay : function(){
		$("#appIdSelect").children().first().nextAll().remove();
		$.map(look._APP_INFO_DIC_ARRAY, function(n){
			$("#appIdSelect").append('<option value="' + n[0] + '" s_id="' + n[2] + '">' + n[1] + '</option>');
		});
		//[事件]
		$("#appIdSelect").bind("change", function(){
			selectChangeFn($(this).val());
		}).children("option[value='" + look.getHashParam("appid") + "']").attr("selected", "selected");
		
		selectChangeFn($("#appIdSelect option[value='" + look.getHashParam("appid") + "']"));
		function selectChangeFn(appId){
			var serverId = $("#appIdSelect option:selected").attr("s_id"),
				selectHtml = "", serverIdArray = new Array();
			$("#serverIdSelect").hide().children().remove();
			if(serverId){
				serverIdArray = serverId.split(",");
				$.each(serverIdArray, function(j){
					selectHtml += '<option value="' + serverIdArray[j] + '">S' + serverIdArray[j] + '</option>';
				});
				selectHtml += '</select></div>';
				$("#serverIdSelect").append(selectHtml).show().children("option[value='" + look.getHashParam("server_id") + "']").attr("selected", "selected");
			}
		}
	}
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 获取“CDN信息字典”callback
//*************************************
var getCDNInfoDictionaryCallback = {
	Convert: function(back){
		if (back.data != "") {
			look._CDN_INFO_DIC_ARRAY.length = 0;
			$.each(back.data.items, function(i){
				look._CDN_INFO_DIC_ARRAY.push(new Array(back.data.items[i].id, back.data.items[i].name, back.data.items[i].type));
			});
		}
		else {
			look.showInfo.error(back.code + ":CDN信息字典数据为空…");
		}
	},
	Assay : function(){
		$("#cdnCheckbox").children().first().nextAll().remove();
		$.map(look._CDN_INFO_DIC_ARRAY, function(n){
			$("#cdnCheckbox").append('<a href="javascript:" class="a_as_checkbox look_box_corner" c_id="' + n[0] + '" c_t="' + n[2] + '"><em>' + n[1] + '</em></a>');
		});
		//[事件]
		publicInit.checkboxStyle("#cdnCheckbox");
	}
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 获取“代理商名称字典”callback
//*************************************
var getAgentDictionaryCallback = {
	Convert: function(back){
		if (back.code == 0) {
			if (back.data != "") {
				look._AGENT_DIC_ARRAY.length = 0;
				$.each(back.data.items, function(i){
					look._AGENT_DIC_ARRAY.push(new Array(back.data.items[i], back.data.items[i]));
				});
				getAgentDictionaryCallback.Assay();
				getAgentDictionaryCallback.AssaySelect();
			}
			else {
				look.showInfo.error(back.code + "：代理商名称字典数据为空…");
			}
		}else{
			look.showInfo.error(back.code + ":" + back.message);
		}
	},
	Assay: function(){
		$.map(look._AGENT_DIC_ARRAY, function(n){
			$(".agent_checkbox_cell").each(function(){
				$(this).append('<a href="javascript:" class="a_as_checkbox look_box_corner agent_checkbox" a_id="' + n[0] + '"><em>' + n[1] + '</em></a>');
			});
		});
		publicInit.checkboxStyle(".repository_info_panel .bottom_cell");
	},
	AssaySelect: function(){
		$.map(look._AGENT_DIC_ARRAY, function(n){
			$("#agentSelect").each(function(){
				$(this).append('<option value="' + n[0] + '">' + n[1] + '</option>');
			});
		});
	}
}

/*** 公共 Callback END ***/

/*** repository Callback START ***/

//*************************************
//* 资源管理系统 -> 资源管理
//* 获取资源库字典 callback
//*************************************
var getRepositoryLibraryCallback = function(back){
	var repositorySelect = $("#repositorySelect");
	repositorySelect.html("").fadeIn();
	$("#repositoryLibraryLoader").hide();
	if(back.data.items && back.data.items.length != 0){
		$.each(back.data.items, function(i){
			repositorySelect.append(
				'<option value="' + back.data.items[i].id + '">' + back.data.items[i].name + '</option>'
			);
		});
		repositorySelect.children("option[value='" + look.getHashParam("library") + "']").attr("selected", "selected");
		look.pipe.set("repository_" + $("#appIdSelect").val(), JSON.stringify(back));
	}else{
		repositorySelect.html('<option value="">无资源库</option>');
	}
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 获取资源库列表 callback
//*************************************
var getRepositoryListCallback = function(back){
	var repositoryListPanel = $("#repositoryListPanel");
	$("#resultCount").text((back.data.count ? back.data.count : "-"));
	$("#resultLoader").hide();
	repositoryListPanel.html("");
	if(back.data.items && back.data.items.length != 0){
		$.each(back.data.items, function(i){
			var cdnName = "";
			var cdns = back.data.items[i].cdns;
			$.each(cdns.split(","), function(j){
				cdnName += '<em class="cdn_name" cdnid="' + cdns.split(",")[j] + '">' + cdns.split(",")[j] + '</em>';
			});
			repositoryListPanel.append(
				'<div class="publisher_panel repository_publisher_panel repository_info_panel" r_id="' + back.data.items[i].id + '">' +
				'	<div class="publisher_cell top">' +
				'		<div class="publisher_title">' + back.data.items[i].id + ' - 资源库：' + back.data.items[i].name + '</div>' +
				'	</div>' +
				'	<div class="publisher_cell">' +
				'		<div class="publisher_row">' +
				'			<span class="label">项目名称：</span>' +
				'			<span appid="' + back.data.items[i].appid + '" class="app_name">' + back.data.items[i].appid + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">CDN：</span>' +
				'			<span>' + cdnName + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">设备类型：</span>' +
				'			<span>' + back.data.items[i].device + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">SVN地址：</span>' +
				'			<span title="' + back.data.items[i].svnUrl + '">' + look.getByteVal(back.data.items[i].svnUrl, 98) + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">创建时间：</span>' +
				'			<span>' + back.data.items[i].createTime + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">更新时间：</span>' +
				'			<span>' + back.data.items[i].updateTime + '</span>' +
				'		</div>' +
				'		<div class="publisher_row">' +
				'			<span class="label">操作者：</span>' +
				'			<span>' + back.data.items[i].opUser + '</span>' +
				'		</div>' +
				'	</div>' +
				'	<div class="publisher_cell">' +
				'		<label class="publisher_label">' +
				'			<tt>备注</tt>' +
				'			<input type="text" class="text publish_remark_input" />' +
				'		</label>' +
				'	</div>' +
				'	<div class="publisher_cell bottom">' +
				'		<div class="bottom_cell_out">' +
				'			<div class="bottom_cell agent_checkbox_cell">' +
				'				<span>发布渠道：</span>' +
				'			</div>' +
				'		</div>' +
				'		<div class="subset_cell">' +
				'			<a href="javascript:" class="a_as_button publish_repository_subset">发布</a>' +
				'			<a href="javascript:" class="a_as_button a_as_red right delete_repository_subset">删除</a>' +
				'		</div>' +
				'	</div>' +
				'</div>'
			);
		});
		repositoryAppNameAssay("#repositoryListPanel .app_name");
		repositoryCDNNameAssay("#repositoryListPanel .cdn_name");
		getAgentDictionaryCallback.Assay();
		publicInit.inputTipStyle(".publisher_label input.publish_remark_input", ".publisher_label tt");
		//[事件]发布
		$(".publish_repository_subset").unbind("click").bind("click", function(){
			var repositoryId = $(this).parents(".repository_info_panel").attr("r_id"),
				repositoryName = $(this).parents(".repository_info_panel").find(".publisher_title").text(),
				publishRemarkInput = $(this).parents(".repository_info_panel").find(".publish_remark_input"),
				publishRemarkValue = $.trim(publishRemarkInput.val()),
				agentCheckbox = $(this).parents(".repository_info_panel").find(".agent_checkbox.selected"),
				agentArray = new Array();
			agentCheckbox.each(function(){
				agentArray.push($(this).attr("a_id"));
			});
			console.log(agentArray);
			if(publishRemarkValue == ""){look.showInfo.error("备注不能为空");publishRemarkInput.focus();return false;}
			if(agentArray.length == 0){look.showInfo.error("请至少选择一个渠道");return false;}
			popRight(
				'<div style="width:500px;">' +
				'	<div class="pop_content_word">' +
				'		<span class="pop_content_span pop_warning_icon">确定发布[<b class="color_green">' + repositoryName + '</b>]？</span>' +
				'	</div>' +
				'	<a href="javascript:" class="a_as_button" id="confirmPublishRepositorySubset" style="height:24px;line-height:24px;width:100px;">确定</a>　<a href="javascript:clearPop();" class="a_as_button a_as_gray" style="height:24px;line-height:24px;width:100px;">取消</a>' +
				'</div>', '提醒');
			$("#confirmPublishRepositorySubset").focus().unbind("click").bind("click", function(){
				if($(this).hasClass("a_as_disabled")){return false;}
				$(this).addClass("a_as_disabled");
				look._TEMP = repositoryId;
				publishRepositoryRequest(repositoryId, publishRemarkValue, agentArray);
			});
		});
		//[事件]删除资源库
		$(".delete_repository_subset").unbind("click").bind("click", function(){
			var repositoryId = $(this).parents(".repository_info_panel").attr("r_id"),
				repositoryName = $(this).parents(".repository_info_panel").find(".publisher_title").text();
			popRight(
				'<div style="width:500px;">' +
				'	<div class="pop_content_word">' +
				'		<span class="pop_content_span pop_warning_icon">确定删除[<b class="color_yellow">' + repositoryName + '</b>]？</span>' +
				'	</div>' +
				'	<a href="javascript:" class="a_as_button" id="confirmDeleteRepositorySubset" style="height:24px;line-height:24px;width:100px;">确定</a>　<a href="javascript:clearPop();" class="a_as_button a_as_gray" style="height:24px;line-height:24px;width:100px;">取消</a>' +
				'</div>', '提醒');
			$("#confirmDeleteRepositorySubset").focus().unbind("click").bind("click", function(){
				if($(this).hasClass("a_as_disabled")){return false;}
				$(this).addClass("a_as_disabled");
				look._TEMP = repositoryId;
				deleteRepositoryRequest(repositoryId);
			});
		});
		look.pipe.set("repository_" + look.getHashParam("appid"), JSON.stringify(back));
	}else{
		repositoryListPanel.append('<div class="no_result">没有任何数据，请输入有效查询条件…</div>');
	}
}
//资源库项目名替换
var repositoryAppNameAssay = function(element){
	if(look._APP_INFO_DIC_ARRAY && look._APP_INFO_DIC_ARRAY != 0){
		$(element).each(function(i){
			var thisElement = $(this),
				appid = thisElement.attr("appid");
			$.map(look._APP_INFO_DIC_ARRAY, function(n){
				if(n[0] == appid){
					thisElement.text(n[1]);
				}
			});
		});
	}
}
//CDN名替换
var repositoryCDNNameAssay = function(element){
	if(look._CDN_INFO_DIC_ARRAY && look._CDN_INFO_DIC_ARRAY != 0){
		$(element).each(function(i){
			var thisElement = $(this),
				cdnid =thisElement.attr("cdnid");
			$.map(look._CDN_INFO_DIC_ARRAY, function(n){
				if(n[0] == cdnid){
					thisElement.text(n[1]);
				}
			});
		});
	}
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 新建资源库 callback
//*************************************
var createRepositoryCallback = function(back){
	clearPop();
	look.showInfo.right(back.code + ":新建资源库成功！");
	$(".new_repository_poper").remove();
	var $appIdSelect = $("#appIdSelect").val();
	if(look.getHashParam("appid") == $appIdSelect){
		$("#resultLoader").show();
		getRepositoryListRequest($appIdSelect);
	}else{
		location.hash = look.setParam([["appid", $appIdSelect]], location.hash);
	}
}
var createRepositoryComplete = function(textStatus){
	$("#confirmCreateSubset").removeClass("a_as_disabled");
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 删除资源库 callback
//*************************************
var deleteRepositoryCallback = function(back){
	clearPop();
	look.showInfo.right(back.code + ":删除资源库成功！");
	look.pipe.remove("repository_*");
	$(".repository_info_panel[r_id='" + look._TEMP + "']").fadeOut(function(){
		$(this).remove();
		$("#resultCount").text($(".repository_info_panel").length);
		if($(".repository_info_panel").length == 0){
			$("#repositoryListPanel").html('<div class="no_result">没有任何数据，请输入有效查询条件…</div>');
		}
	});
}
var deleteRepositoryComplete = function(textStatus){
	$("#confirmDeleteRepositorySubset").removeClass("a_as_disabled");
}

//*************************************
//* 资源管理系统 -> 资源管理
//* 发布资源库 callback
//*************************************
var publishRepositoryCallback = function(back){
	clearPop();
	look.showInfo.right(back.code + ":发布提交队列成功，等待系统发布…");
	look.pipe.remove("repository_*");
	getRepositoryListRequest($("#appIdSelect").val());
}
var publishRepositoryComplete = function(textStatus){
	$("#confirmPublishRepositorySubset").removeClass("a_as_disabled");
}

//*************************************
//* 资源管理系统 -> 资源发布历史
//* 获取发布历史 callback
//*************************************
var getRepositoryHistoryCallback = function(back){
	var repositoryHistoryList = $("#repositoryHistoryList");
	$("#resultCount").text((back.data.totalCount ? back.data.totalCount : "-"));
	$("#resultLoader").hide();
	repositoryHistoryList.children().first().nextAll().remove();
	if(back.data.items && back.data.items.length != 0){
		$.each(back.data.items, function(i, list){
			var cdnName = "", cdns = list.cdns, repositoryState = "", state = list.state, channels = null, channelHtml = "";
			$.each(cdns.split(","), function(j){
				cdnName += (j == 0 ? "" : ",") + '<em class="cdn_name" cdnid="' + cdns.split(",")[j] + '">' + cdns.split(",")[j] + '</em>';
			});
			switch(state){
				case 0 : repositoryState = '<b class="color_yellow">进行中</b>';
					break;
				case 1 : repositoryState = '<b class="color_green">成功</b>';
					break;
				case 2 : repositoryState = '<b class="color_red">失败</b>';
					break;
				default : repositoryState = '<b class="color_gray">无法获取</b>';
			}
			if(list.channel){
				channels = list.channel.split(",");
				for(j = 0; j < channels.length; j++){
					channelHtml += (j == 0 ? "" : " ") + '<a href="' + look.setParam([["channel", channels[j]]], location.hash).split("&page")[0] + '" class="blue">' + channels[j] + '</a>';
				}
			}else{
				channelHtml = "N/A";
			}
			repositoryHistoryList.append(
				'<tr h_id="' + list.id + '" svn_version="' + list.svnVersion + '">' +
				'	<td>' + list.id + '</td>' +
				'	<td>' + list.reposityId + '</td>' +
				'	<td>' + list.reposityName + '</td>' +
				'	<td appid="' + list.appid + '" class="app_name">' + list.appid + '</td>' +
				'	<td>' + list.device + '</td>' +
				'	<td>' + list.svnVersion + '</td>' +
				'	<td><a href="javascript:" svn_url="' + list.svnUrl + '" class="svn_url_subset blue">查看</a></td>' +
				'	<td>' + cdnName + '</td>' +
				'	<td width="7%">' + channelHtml + '</td>' +
				'	<td>' + list.createTime + '</td>' +
				'	<td>' + list.updateTime + '</td>' +
				'	<td>' + repositoryState + '</td>' +
				'	<td>' + list.opUser + '</td>' +
				'	<td><div st="' + list.message + '" class="message_subset color_gray">' + look.getByteVal(list.message, 10) + '..<a href="javascript:" class="modify_message_subset blue">修改</a></div></td>' +
				'	<td><a href="javascript:" class="a_as_button sql_query_subset' + (list.sqls == "" ? ' a_as_disabled' : '') + '">SQL</a> <a href="javascript:" class="a_as_button log_query_subset">LOG</a> <a href="javascript:" class="a_as_button json_query_subset' + (list.pubJson == "" ? ' a_as_disabled' : '') + '">JSON</a> <a href="javascript:" class="a_as_button check_subset a_as_gray">检测</a></td>' +
				'</tr>'
			);
			look.pipe.remove("sql_" + list.id);
			look.pipe.set("sql_" + list.id, list.sqls);
			look.pipe.remove("log_" + list.id);
			look.pipe.set("log_" + list.id, list.logs);
			look.pipe.remove("json_" + list.id);
			look.pipe.set("json_" + list.id, list.pubJson);
		});
		repositoryHistoryList.append('<div class="clear"></div>');
		repositoryAppNameAssay("#repositoryHistoryList .app_name");
		repositoryCDNNameAssay("#repositoryHistoryList .cdn_name");
		publicInit.tabelStyle();
		
		$(".message_subset").floater({
			closer:false,
			backgroundColor:"#333",
			borderColor:'#333',
			fontColor:'#fff',
			padding:[4,6,4,6]
		});
		
		function getPoperRequest(obj, url, callback){
			var offLeft = obj.offset().left - 210,
				offTop = obj.offset().top + 20;
			$.get(url, function(text){
				$.lookpop({
					left: offLeft,
					top: offTop,
					addClass: "change_message_poper",
					contentHtml: text
				});
				eval(callback());
			});
		}
		
		//[事件]修改备注
		$(".modify_message_subset").bind("click", function(event){
			event.stopPropagation();
			var messageId = $(this).parents("tr").attr("h_id");
			var confirmModifyCallback = function(){
				publicInit.inputTipStyle(".envelop_poper input.text", ".envelop_poper label tt");
				$("#messageInput").focus();
				$("#popModifyMessageSubset").bind("click", function(){
					var message = $.trim($("#messageInput").val());
					if(message == ""){look.showInfo.error("备注内容不能为空");$("#messageInput").focus();return false;}
					popError(
						'<div style="width:500px;">' +
						'	<div class="pop_content_word">' +
						'		<span class="pop_content_span pop_warning_icon">确定要修改该备注？</span>' +
						'	</div>' +
						'	<a href="javascript:" class="a_as_button" id="comfirmModifySubset" style="height:24px;line-height:24px;width:100px;">' + look._I18N_DATA.$600/**确定**/ + '</a>　<a href="javascript:clearPop();" class="a_as_button a_as_gray" style="height:24px;line-height:24px;width:100px;">' + look._I18N_DATA.$601/**取消**/ + '</a>' +
						'</div>', look._I18N_DATA.$66/**提醒**/);
					$("#comfirmModifySubset").focus().unbind("click").bind("click", function(){
						if($(this).hasClass("a_as_disabled")){return false;}
						$(this).addClass("a_as_disabled");
						modifyRepositoryMessageRequest(messageId, message)
					}).parents(".pop_dialog_table").bind("click", function(event){
						event.stopPropagation();
					});
				});
			}
			getPoperRequest($(this), "repository/modify_message_poper.html", confirmModifyCallback);
		});
		
		//[事件]SQL查询&LOG查询&JSON查询
		$(".sql_query_subset,.log_query_subset,.json_query_subset").unbind("click").bind("click", function(event){
			if($(this).hasClass("a_as_disabled")){return false;}
			event.stopPropagation();
			var elment = $(this).parents("tr"),
				hid = elment.attr("h_id"),
				publisherTitle = elment.children().eq(2).text();
			var type = $(this).text().toLocaleLowerCase();
			popDiv("repository/sql_log_poper.html");
			$("#sqlLogCell").html(look.pipe.get(type + "_" + hid).replace(/(;)/g, ";<br><br>"));
			$(".pop_content_title").html(type.toLocaleUpperCase() + '@' + publisherTitle + '　<a href="javascript:" class="blue" id="selectedAllSubset">[全选]</a>');
			//[事件]全选
			$("#selectedAllSubset").unbind("click").bind("click", function(){
				look.selectContents(".sql_log_cell pre");
			});
		});
		//[事件]查看svn地址
		$(".svn_url_subset").unbind("click").bind("click", function(event){
			event.stopPropagation();
			popRight(
				'<div style="width:620px;">' +
				'	<div class="pop_content_word">' +
				'		<span class="pop_content_span">' + $(this).attr("svn_url") + '</span>' +
				'	</div>' +
				'	<a href="javascript:clearPop();" class="a_as_button a_as_gray" style="height:24px;line-height:24px;width:100px;">关闭</a>' +
				'</div>', 'SVN地址');
			look.selectContents(".pop_content_span");
			$(".pop_content_span").bind("click", function(){look.selectContents($(this));});
		});
		//[事件]选择对比项
		repositoryHistoryList.children("tr:not(:first)").bind("click", function(){
			$(this).toggleClass("selected");
			if (repositoryHistoryList.children(".selected").length > 2) {
				look.showInfo.error("只能选两项进行对比，再次点击取消选择项");
				$(this).removeClass("selected");
			}
		});
		//[事件]检测
		$(".check_subset").unbind("click").bind("click", function(event){
			event.stopPropagation();
			var elment = $(this).parents("tr"),
				hid = elment.attr("h_id");
			if($(this).hasClass("a_as_disabled")){return false;}
			$(this).addClass("a_as_disabled");
			look._TEMP = $(this);
			checkUrlRequest(hid);
		});
	}else{
		repositoryHistoryList.append('<tr><td colspan="15">没有任何数据，请输入有效查询条件…</td></tr>');
	}
	setPager(".pager", look._PAGER_SIZE * 2, location.hash.split("&page="), back.data.totalCount);
}


//*************************************
//* 资源管理系统 -> 资源管理
//* 修改发布备注 callback
//*************************************
var modifyRepositoryMessageCallback = function(back){
	clearPop();
	look.showInfo.right(back.code + ":备注修改成功…");
	$(".change_message_poper").remove();
	location.hash = look.setParam([[]], location.hash);
}
var modifyRepositoryMessageComplete = function(textStatus){
	$("#comfirmModifySubset").removeClass("a_as_disabled");
}

//*************************************
//* 资源管理系统 -> 资源发布历史
//* 对比历史记录 callback
//*************************************
var contrastHistoryCallback = function(back){
	var contrastHistoryPanel = $("#contrastHistoryPanel"),
		selectedItem = $("#repositoryHistoryList tr.selected"),
		selectedArray = new Array();
	selectedItem.each(function(){
		selectedArray.push($(this).attr("svn_version"));
	});
	$("#contrastHistoryPoper").children(".pop_content_title").html("Version" + selectedArray[0] + "　<-->　" + "Version" + selectedArray[1]);
	if(back.data && back.data.length != 0){
		var resultHtml = "";
		for(var x in back.data){
			$("#popTabBar").append('<div class="tab_bar_subset"><a href="javascript:">' + x + '</a></div>');
			resultHtml += '<div class="result_panel look_box_corner look_box_shadow look_hidden">';
			for(var y in back.data[x]){
				var resultContentHtml = "", resultHeaderHtml = "", flag = true;
				resultHtml += '<div class="result_table_title">' + y + '</div>';
				resultHtml += 
					'<div class="result_table">' +
					'	<table cellpadding="0" cellspacing="0" class="list">' +
					'		<tbody>';
				$.each(back.data[x][y], function(i){
					for (var z in back.data[x][y][i]) {
						flag ? resultHeaderHtml += '<tr>' : "";
						if(y == "modify"){
							i % 2 == 0 ? resultContentHtml += '<tr>' : resultContentHtml += '<tr class="combine">';
						}else{
							resultContentHtml += '<tr>';
						}
						for (var o in back.data[x][y][i][z]) {
//							console.log(o + "-->" + back.data[x][y][i][z][o]);
							flag ? resultHeaderHtml += '<th>' + o + '</th>' : "";
							resultContentHtml += '<td>' + back.data[x][y][i][z][o] + '</td>';
						}
						flag ? resultHeaderHtml += '</tr>' : "";
						resultContentHtml += '</tr>';
						flag = false;
					}
				});
				resultHtml += 
					resultHeaderHtml +
					resultContentHtml +
					'		</tbody>' +
					'	</table>' +
					'</div>';
			}
			resultHtml += '</div>';
		}
		$("#popLoadResult").hide();
		$("#contrastHistoryPanel").append(resultHtml);
		$("#popTabBar a:first").addClass("selected");
		$("#contrastHistoryPanel .result_panel:first").show();
		//[事件]标签切换
		$("#contrastHistoryPoper .tab_bar a").bind("click", function(){
			var index = $(this).parent().index();
			$(this).addClass("selected").parent().siblings().children().removeClass("selected");
			$("#contrastHistoryPoper .result_panel").eq(index).show().siblings().hide();
		});
	}
}

//*************************************
//* 资源管理系统 -> 资源发布历史
//* 检测 callback
//*************************************
var checkUrlCallback = function(back){
	if(back.data && back.data.length != 0){
		popDiv("repository/url_poper.html");
		$(".pop_content_title").html('以下为请求超时的文件@' + look._TEMP.parents("tr").children().eq(0).text());
		$.each(back.data, function(i, list){
			$("#listCell").append(list + "</br>");
		});
	}else{
		look.showInfo.right("一切正常");
	}
}
var checkUrlComplete = function(){
	look._TEMP.removeClass("a_as_disabled");
}

/*** repository Callback END ***/
